/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VlastnostiObjektuDialog.java
 *
 * Created on 14.6.2012, 8:06:11
 */
package cz.worsik.vypocty.topeni.tepelneztraty.view;

import cz.worsik.vypocty.topeni.tepelneztraty.model.Objekt;
import cz.worsik.vypocty.topeni.tepelneztraty.model.VychoziHodnoty;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.text.ParseException;
import javax.swing.JOptionPane;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author 231260
 */
public final class VlastnostiObjektuDialog extends javax.swing.JDialog {
	
	private Objekt objekt;
	
	private static final Logger log = LoggerFactory.getLogger(VlastnostiObjektuDialog.class);

	/** Creates new form VlastnostiObjektuDialog */
	public VlastnostiObjektuDialog() {
	}
	
	public void createDialog(Objekt objekt)
	{
		initComponents();
		Toolkit tk = Toolkit.getDefaultToolkit();
		Dimension screenSize = tk.getScreenSize();
		int x = (screenSize.width-this.getWidth())/2;
		int y = (screenSize.height-this.getHeight())/2;
		setLocation(x,y);
		setObjekt(objekt);
	}

	public Objekt getObjekt() {
		return objekt;
	}

	public void setObjekt(Objekt objekt) {
		this.objekt = objekt;
		if (objekt == null)
			this.objekt = new Objekt();
		nactiZmenyDoPoli();
	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        radioObjektTeplotaVenkovni = new javax.swing.ButtonGroup();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        editObjektNazev = new javax.swing.JTextField();
        radioTeplota_12 = new javax.swing.JRadioButton();
        radioTeplota_15 = new javax.swing.JRadioButton();
        radioTeplota_18 = new javax.swing.JRadioButton();
        editObjektCharCislo = new javax.swing.JTextField();
        spinnerPocetNP = new javax.swing.JSpinner();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        spinnerPocetPP = new javax.swing.JSpinner();
        ulozVlastnostiObjektuButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        editSoucinitelStenaVnejsi = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        editSoucinitelStenaVnitrni = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        editSoucinitelPodlaha = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        editSoucinitelStrop = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        editSoucinitelStrecha = new javax.swing.JTextField();
        editSoucinitelOkno = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        editSoucinitelDvereVnejsi = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        editSoucinitelDvereVnitrni = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        editPruvzdusnostOkno = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        editPruvzdusnostDvere = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Vlastnosti objektu");
        setMinimumSize(new java.awt.Dimension(380, 430));
        setName("vlastnostiObjektuDialog"); // NOI18N
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Zadejte prosím vlastnosti objektu :");
        jLabel2.setPreferredSize(new java.awt.Dimension(380, 30));
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jLabel4.setText("Název:");
        jLabel4.setPreferredSize(new java.awt.Dimension(150, 24));
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1));

        jLabel6.setText("Venkovní teplota:");
        jLabel6.setPreferredSize(new java.awt.Dimension(150, 24));
        getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 54, -1, -1));

        jLabel8.setText("Charakteristické č. budovy:");
        jLabel8.setPreferredSize(new java.awt.Dimension(150, 24));
        getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 78, -1, -1));

        jLabel11.setText("Počet podlaží:");
        jLabel11.setPreferredSize(new java.awt.Dimension(150, 24));
        getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 102, -1, -1));

        editObjektNazev.setText("novyObjekt");
        editObjektNazev.setMaximumSize(new java.awt.Dimension(172, 20));
        editObjektNazev.setMinimumSize(new java.awt.Dimension(172, 20));
        editObjektNazev.setName(""); // NOI18N
        editObjektNazev.setNextFocusableComponent(radioTeplota_12);
        editObjektNazev.setPreferredSize(new java.awt.Dimension(180, 20));
        getContentPane().add(editObjektNazev, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 32, -1, -1));

        radioObjektTeplotaVenkovni.add(radioTeplota_12);
        radioTeplota_12.setText("-12 °C");
        radioTeplota_12.setActionCommand("-12");
        radioTeplota_12.setNextFocusableComponent(radioTeplota_15);
        radioTeplota_12.setPreferredSize(new java.awt.Dimension(60, 24));
        getContentPane().add(radioTeplota_12, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 54, -1, -1));

        radioObjektTeplotaVenkovni.add(radioTeplota_15);
        radioTeplota_15.setSelected(true);
        radioTeplota_15.setText("-15 °C");
        radioTeplota_15.setActionCommand("-15");
        radioTeplota_15.setNextFocusableComponent(radioTeplota_18);
        radioTeplota_15.setPreferredSize(new java.awt.Dimension(60, 24));
        getContentPane().add(radioTeplota_15, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 54, -1, -1));

        radioObjektTeplotaVenkovni.add(radioTeplota_18);
        radioTeplota_18.setText("-18 °C");
        radioTeplota_18.setActionCommand("-18");
        radioTeplota_18.setNextFocusableComponent(editObjektCharCislo);
        radioTeplota_18.setPreferredSize(new java.awt.Dimension(60, 24));
        getContentPane().add(radioTeplota_18, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 54, -1, -1));

        editObjektCharCislo.setText("8");
        editObjektCharCislo.setMaximumSize(new java.awt.Dimension(172, 20));
        editObjektCharCislo.setMinimumSize(new java.awt.Dimension(172, 20));
        editObjektCharCislo.setNextFocusableComponent(spinnerPocetNP);
        editObjektCharCislo.setPreferredSize(new java.awt.Dimension(180, 20));
        getContentPane().add(editObjektCharCislo, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 80, -1, -1));

        spinnerPocetNP.setMaximumSize(new java.awt.Dimension(71, 20));
        spinnerPocetNP.setMinimumSize(new java.awt.Dimension(71, 20));
        spinnerPocetNP.setNextFocusableComponent(spinnerPocetPP);
        spinnerPocetNP.setPreferredSize(new java.awt.Dimension(50, 20));
        spinnerPocetNP.setValue(1);
        getContentPane().add(spinnerPocetNP, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 104, -1, -1));

        jLabel1.setText("PP");
        jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel1.setPreferredSize(new java.awt.Dimension(25, 24));
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(335, 102, -1, -1));

        jLabel3.setText("NP");
        jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel3.setPreferredSize(new java.awt.Dimension(25, 24));
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(235, 102, -1, -1));

        spinnerPocetPP.setMaximumSize(new java.awt.Dimension(71, 20));
        spinnerPocetPP.setMinimumSize(new java.awt.Dimension(71, 20));
        spinnerPocetPP.setNextFocusableComponent(editSoucinitelStenaVnejsi);
        spinnerPocetPP.setPreferredSize(new java.awt.Dimension(50, 20));
        spinnerPocetPP.setValue(0);
        getContentPane().add(spinnerPocetPP, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 104, -1, -1));

        ulozVlastnostiObjektuButton.setText("Uložit hodnoty");
        ulozVlastnostiObjektuButton.setPreferredSize(new java.awt.Dimension(120, 24));
        ulozVlastnostiObjektuButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ulozVlastnostiObjektuButtonActionPerformed(evt);
            }
        });
        getContentPane().add(ulozVlastnostiObjektuButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 370, -1, -1));

        jSeparator1.setMinimumSize(new java.awt.Dimension(380, 10));
        jSeparator1.setPreferredSize(new java.awt.Dimension(380, 2));
        getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 135, -1, -1));

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel12.setText("Výchozí hodnoty součinitelů prostupů tepla :");
        jLabel12.setPreferredSize(new java.awt.Dimension(380, 30));
        getContentPane().add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 140, -1, -1));

        jLabel13.setText("Stěna vnější:");
        jLabel13.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel13.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel13.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 170, -1, -1));

        editSoucinitelStenaVnejsi.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelStenaVnejsi.setText("0,3");
        editSoucinitelStenaVnejsi.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelStenaVnejsi.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStenaVnejsi.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStenaVnejsi.setNextFocusableComponent(editSoucinitelStenaVnitrni);
        editSoucinitelStenaVnejsi.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelStenaVnejsi, new org.netbeans.lib.awtextra.AbsoluteConstraints(95, 172, -1, -1));

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel14.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel14.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 170, -1, -1));

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel15.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel15.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 194, -1, -1));

        editSoucinitelStenaVnitrni.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelStenaVnitrni.setText("0,3");
        editSoucinitelStenaVnitrni.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelStenaVnitrni.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStenaVnitrni.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStenaVnitrni.setNextFocusableComponent(editSoucinitelPodlaha);
        editSoucinitelStenaVnitrni.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelStenaVnitrni, new org.netbeans.lib.awtextra.AbsoluteConstraints(95, 196, -1, -1));

        jLabel16.setText("Stěna vnitřní:");
        jLabel16.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel16.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel16.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 194, -1, -1));

        jLabel17.setText("Podlaha:");
        jLabel17.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel17.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel17.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 218, -1, -1));

        editSoucinitelPodlaha.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelPodlaha.setText("0,3");
        editSoucinitelPodlaha.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelPodlaha.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelPodlaha.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelPodlaha.setNextFocusableComponent(editSoucinitelStrop);
        editSoucinitelPodlaha.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelPodlaha, new org.netbeans.lib.awtextra.AbsoluteConstraints(95, 220, -1, -1));

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel18.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel18.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 218, -1, -1));

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel19.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel19.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 242, -1, -1));

        editSoucinitelStrop.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelStrop.setText("0,3");
        editSoucinitelStrop.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelStrop.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStrop.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStrop.setNextFocusableComponent(editSoucinitelStrecha);
        editSoucinitelStrop.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelStrop, new org.netbeans.lib.awtextra.AbsoluteConstraints(95, 244, -1, -1));

        jLabel20.setText("Strop:");
        jLabel20.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel20.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel20.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 242, -1, -1));

        jLabel21.setText("Střecha:");
        jLabel21.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel21.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel21.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 170, -1, -1));

        jLabel22.setText("Okno:");
        jLabel22.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel22.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel22.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 194, -1, -1));

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel23.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel23.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 170, -1, -1));

        editSoucinitelStrecha.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelStrecha.setText("0,3");
        editSoucinitelStrecha.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelStrecha.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStrecha.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelStrecha.setNextFocusableComponent(editSoucinitelOkno);
        editSoucinitelStrecha.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelStrecha, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 172, -1, -1));

        editSoucinitelOkno.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelOkno.setText("0,3");
        editSoucinitelOkno.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelOkno.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelOkno.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelOkno.setNextFocusableComponent(editSoucinitelDvereVnejsi);
        editSoucinitelOkno.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelOkno, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 196, -1, -1));

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel24.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel24.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 194, -1, -1));

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel25.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel25.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 218, -1, -1));

        editSoucinitelDvereVnejsi.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelDvereVnejsi.setText("0,3");
        editSoucinitelDvereVnejsi.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelDvereVnejsi.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelDvereVnejsi.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelDvereVnejsi.setNextFocusableComponent(editSoucinitelDvereVnitrni);
        editSoucinitelDvereVnejsi.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelDvereVnejsi, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 220, -1, -1));

        jLabel26.setText("Dveře vnější:");
        jLabel26.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel26.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel26.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel26, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 218, -1, -1));

        jLabel27.setText("Dveře vnitřní:");
        jLabel27.setMaximumSize(new java.awt.Dimension(70, 14));
        jLabel27.setMinimumSize(new java.awt.Dimension(70, 14));
        jLabel27.setPreferredSize(new java.awt.Dimension(80, 24));
        getContentPane().add(jLabel27, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 242, -1, -1));

        editSoucinitelDvereVnitrni.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editSoucinitelDvereVnitrni.setText("0,3");
        editSoucinitelDvereVnitrni.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editSoucinitelDvereVnitrni.setMaximumSize(new java.awt.Dimension(30, 20));
        editSoucinitelDvereVnitrni.setMinimumSize(new java.awt.Dimension(30, 20));
        editSoucinitelDvereVnitrni.setNextFocusableComponent(editPruvzdusnostOkno);
        editSoucinitelDvereVnitrni.setPreferredSize(new java.awt.Dimension(30, 20));
        getContentPane().add(editSoucinitelDvereVnitrni, new org.netbeans.lib.awtextra.AbsoluteConstraints(275, 244, -1, -1));

        jLabel28.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel28.setText("<html>\nWm<sup>-2</sup> K<sup>-1</sup>\n</html>");
        jLabel28.setPreferredSize(new java.awt.Dimension(50, 24));
        getContentPane().add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 242, -1, -1));

        jSeparator2.setMinimumSize(new java.awt.Dimension(380, 10));
        jSeparator2.setPreferredSize(new java.awt.Dimension(380, 2));
        getContentPane().add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 275, -1, -1));

        jLabel29.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel29.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel29.setText("<html> Výchozí hodnoty spárové průvzdušnosti i<sub>L,V</sub> : </html>");
        jLabel29.setPreferredSize(new java.awt.Dimension(380, 30));
        getContentPane().add(jLabel29, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 280, -1, -1));

        jLabel30.setText("Průvzdušnost okny:");
        jLabel30.setPreferredSize(new java.awt.Dimension(130, 24));
        getContentPane().add(jLabel30, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 310, -1, -1));

        editPruvzdusnostOkno.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editPruvzdusnostOkno.setText("0,85");
        editPruvzdusnostOkno.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editPruvzdusnostOkno.setMaximumSize(new java.awt.Dimension(50, 20));
        editPruvzdusnostOkno.setMinimumSize(new java.awt.Dimension(50, 20));
        editPruvzdusnostOkno.setNextFocusableComponent(editPruvzdusnostDvere);
        editPruvzdusnostOkno.setPreferredSize(new java.awt.Dimension(50, 20));
        getContentPane().add(editPruvzdusnostOkno, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 312, -1, -1));

        jLabel31.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel31.setText("<html>\n&middot; 10<sup>-4</sup> m<sup>3</sup>/ m &middot; s &middot; Pa<sup>0,67</sup>\n</html>");
        jLabel31.setPreferredSize(new java.awt.Dimension(150, 24));
        getContentPane().add(jLabel31, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 310, -1, -1));

        jLabel32.setText("Průvzdušnost dveřmi:");
        jLabel32.setPreferredSize(new java.awt.Dimension(130, 24));
        getContentPane().add(jLabel32, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 334, -1, -1));

        editPruvzdusnostDvere.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        editPruvzdusnostDvere.setText("0,85");
        editPruvzdusnostDvere.setMargin(new java.awt.Insets(2, 2, 2, 0));
        editPruvzdusnostDvere.setMaximumSize(new java.awt.Dimension(50, 20));
        editPruvzdusnostDvere.setMinimumSize(new java.awt.Dimension(50, 20));
        editPruvzdusnostDvere.setNextFocusableComponent(ulozVlastnostiObjektuButton);
        editPruvzdusnostDvere.setPreferredSize(new java.awt.Dimension(50, 20));
        getContentPane().add(editPruvzdusnostDvere, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 336, -1, -1));

        jLabel33.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel33.setText("<html>\n&middot; 10<sup>-4</sup> m<sup>3</sup>/ m &middot; s &middot; Pa<sup>0,67</sup>\n</html>");
        jLabel33.setPreferredSize(new java.awt.Dimension(150, 24));
        getContentPane().add(jLabel33, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 334, -1, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void ulozVlastnostiObjektuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ulozVlastnostiObjektuButtonActionPerformed
		ulozVlastnostiAZavriOkno();
	}//GEN-LAST:event_ulozVlastnostiObjektuButtonActionPerformed

	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[]) {
		/* Set the Nimbus look and feel */
		//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
		 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(VlastnostiObjektuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(VlastnostiObjektuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(VlastnostiObjektuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(VlastnostiObjektuDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		}
		//</editor-fold>
	}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField editObjektCharCislo;
    private javax.swing.JTextField editObjektNazev;
    private javax.swing.JTextField editPruvzdusnostDvere;
    private javax.swing.JTextField editPruvzdusnostOkno;
    private javax.swing.JTextField editSoucinitelDvereVnejsi;
    private javax.swing.JTextField editSoucinitelDvereVnitrni;
    private javax.swing.JTextField editSoucinitelOkno;
    private javax.swing.JTextField editSoucinitelPodlaha;
    private javax.swing.JTextField editSoucinitelStenaVnejsi;
    private javax.swing.JTextField editSoucinitelStenaVnitrni;
    private javax.swing.JTextField editSoucinitelStrecha;
    private javax.swing.JTextField editSoucinitelStrop;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.ButtonGroup radioObjektTeplotaVenkovni;
    private javax.swing.JRadioButton radioTeplota_12;
    private javax.swing.JRadioButton radioTeplota_15;
    private javax.swing.JRadioButton radioTeplota_18;
    private javax.swing.JSpinner spinnerPocetNP;
    private javax.swing.JSpinner spinnerPocetPP;
    private javax.swing.JButton ulozVlastnostiObjektuButton;
    // End of variables declaration//GEN-END:variables

	private void nactiZmenyDoPoli() {
		editObjektNazev.setText(objekt.getNazev());
		radioObjektTeplotaVenkovni.clearSelection();
		if (objekt.getTeplota_venkovni() == (Double.parseDouble(radioTeplota_12.getActionCommand())))
		{
			radioObjektTeplotaVenkovni.setSelected(radioTeplota_12.getModel(), true);
		}
		else if (objekt.getTeplota_venkovni() == (Double.parseDouble(radioTeplota_15.getActionCommand())))
		{
			radioObjektTeplotaVenkovni.setSelected(radioTeplota_15.getModel(), true);
		}
		else if (objekt.getTeplota_venkovni() == (Double.parseDouble(radioTeplota_15.getActionCommand())))
		{
			radioObjektTeplotaVenkovni.setSelected(radioTeplota_15.getModel(), true);
		}
		editObjektCharCislo.setText(""+objekt.getChar_cislo_budovy());
		spinnerPocetNP.setValue(objekt.getPocet_podlazi_np());
		spinnerPocetPP.setValue(objekt.getPocet_podlazi_pp());
		
		VychoziHodnoty soucinitele = objekt.getVychoziHodnoty();
		if (soucinitele == null)
		{
			soucinitele = new VychoziHodnoty();
			objekt.setVychoziHodnoty(soucinitele);
		}
		editSoucinitelStenaVnejsi.setText(String.valueOf(soucinitele.getK_stena_vnejsi()));
		editSoucinitelStenaVnitrni.setText(String.valueOf(soucinitele.getK_stena_vnitrni()));
		editSoucinitelPodlaha.setText(String.valueOf(soucinitele.getK_podlaha()));
		editSoucinitelStrop.setText(String.valueOf(soucinitele.getK_strop()));
		editSoucinitelStrecha.setText(String.valueOf(soucinitele.getK_strecha()));
		editSoucinitelOkno.setText(String.valueOf(soucinitele.getK_stena_okno()));
		editSoucinitelDvereVnejsi.setText(String.valueOf(soucinitele.getK_dvere_vnejsi()));
		editSoucinitelDvereVnitrni.setText(String.valueOf(soucinitele.getK_dvere_vnitrni()));

		editPruvzdusnostOkno.setText(String.valueOf(soucinitele.getI_okno()));
		editPruvzdusnostDvere.setText(String.valueOf(soucinitele.getI_dvere()));
	}
	
	private void ulozVlastnostiAZavriOkno()
	{
		// nacti vlastnosti objektu
		objekt.setNazev(editObjektNazev.getText());
		
		int teplota = Integer.parseInt(
			radioObjektTeplotaVenkovni.getSelection().getActionCommand()
		);
		objekt.setTeplota_venkovni(teplota);
		objekt.setChar_cislo_budovy(Integer.parseInt(editObjektCharCislo.getText()));
		objekt.setPocet_podlazi_np(Integer.parseInt(spinnerPocetNP.getValue().toString()));
		objekt.setPocet_podlazi_pp(Integer.parseInt(spinnerPocetPP.getValue().toString()));
		objekt.setJe_podsklepeny(objekt.getPocet_podlazi_pp() > 0);
		
		// nacti vychozi hodnoty koeficientu
		// TODO koeficienty
		VychoziHodnoty soucinitele = new VychoziHodnoty();
		try
		{
			soucinitele.setK_stena_vnejsi(editSoucinitelStenaVnejsi.getText());
			soucinitele.setK_stena_vnitrni(editSoucinitelStenaVnitrni.getText());
			soucinitele.setK_podlaha(editSoucinitelPodlaha.getText());
			soucinitele.setK_strop(editSoucinitelStrop.getText());
			soucinitele.setK_strecha(editSoucinitelStrecha.getText());
			soucinitele.setK_stena_okno(editSoucinitelOkno.getText());
			soucinitele.setK_dvere_vnejsi(editSoucinitelDvereVnejsi.getText());
			soucinitele.setK_dvere_vnitrni(editSoucinitelDvereVnitrni.getText());

			soucinitele.setI_okno(editPruvzdusnostOkno.getText());
			soucinitele.setI_dvere(editPruvzdusnostDvere.getText());

			objekt.setVychoziHodnoty(soucinitele);
			
			setObjekt(objekt);
			
			// zavrit okno
			this.dispose();
		}
		catch (ParseException e)
		{
			// Problem pri parsovani
			log.error("Nastal problem pri parsovani vychozich hodnot soucinitelu objektu.",e);
			JOptionPane.showMessageDialog(null,
                    "Zadané hodnoty nelze uložit. Prosím zkontrolujte jejich formát. (Oddělovač desetinných míst je ',')",
                    "Chyba při načítání hodnot", JOptionPane.ERROR_MESSAGE);
		}
	}
}
